/******************************************************************************

	COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2010.

	This file is part of Maxsi Engine.

	Maxsi Engine is free software: you can redistribute it and/or modify it
	under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or (at your
	option) any later version.

	Maxsi engine is distributed in the hope that it will be useful, but WITHOUT
	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
	FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
	for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with Maxsi Engine. If not, see <http://www.gnu.org/licenses/>.

	MaxsiEngine.dll
	A general purpose C++ library for the Maxsi Technology Project.

	MaxsiError.h
	Defines all the error codes used within the Maxsi Engine project.

****************************************************************************/

#ifndef MaxsiError_H
#define MaxsiError_H

BeginMaxsiNamespace

//=============================================================================
//	Error Codes used within the Maxsi Engine. Please note that the data type
//	used to store these values should be MaxsiError. Remember to edit
//	MaxsiError.cpp as well to reflect changes.
//=============================================================================
#define	MAXSI_ERROR_SUCCESS					0
#define MAXSI_ERROR_UNSPECIFIED				1
#define	MAXSI_ERROR_MEM_ALLOC_FAIL			2
#define	MAXSI_ERROR_OUT_OF_MEM				3
#define	MAXSI_ERROR_ACCESS_VIOLATION		4
#define	MAXSI_ERROR_NOT_INITIALIZED			5
#define	MAXSI_ERROR_IS_IN_USE				6
#define MAXSI_ERROR_NOT_IMPLEMENTED			7
#define MAXSI_ERROR_COULD_NOT_OPEN			8
#define MAXSI_ERROR_COULD_NOT_CONNECT		9
#define MAXSI_ERROR_INVALID_HEADER			10
#define MAXSI_ERROR_UNSUPPORTED_VERSION		11
#define MAXSI_ERROR_OUTDATED_VERSION		12
#define MAXSI_ERROR_INVALID_INPUT			13
#define MAXSI_ERROR_THIS_SHOULD_NOT_HAPPEN	14
#define MAXSI_ERROR_FILE_TOO_BIG			15
#define MAXSI_ERROR_FILE_TOO_BIG_FOR_FS		16
#define MAXSI_ERROR_INPUT_TOO_BIG			17
#define MAXSI_ERROR_CONNECTION_ISSUE		18
#define MAXSI_ERROR_NOT_SUPPORTED			19
#define MAXSI_ERROR_PENDING					20
#define MAXSI_ERROR_COULD_NOT_CREATE_SOCKET	21
#define MAXSI_ERROR_COULD_NOT_BIND_SOCKET	22
#define MAXSI_ERROR_COULD_NOT_SET_NON_BLOCK	23
#define MAXSI_ERROR_COULD_NOT_LISTEN		24
#define MAXSI_ERROR_COULD_NOT_TRANSFER		25
#define MAXSI_ERROR_DNS_LOOKUP_FAILED		26
#define MAXSI_ERROR_ALREADY_CONNECTED		27
#define MAXSI_ERROR_ALREADY_INITIALIZED		28
#define MAXSI_ERROR_COULD_NOT_CREATE_THREAD	29
#define MAXSI_ERROR_COULD_NOT_CONVERT_TEXT	30
#define MAXSI_ERROR_COULD_NOT_CREATE_WINDOW	31
#define MAXSI_NUM_ERRORS					32

//=============================================================================
//	Useful sections to mark sections of code that either went wrong or needs
//	the attention from a programmer.
//=============================================================================
#if defined(Maxsi_Debug_Build) // If the program is being compiled for testing.

#define MAXSI_TODO(Message)
#define MAXSI_TODO_LOW(Message)
#define MAXSI_UNDEFINED_BEHAVIOR(Message)
#define MAXSI_REMOVE_ME()
#define MAXSI_REMOVE_ME_LOW()
#define MAXSI_REMOVE_OLD_CODE()
#define MAXSI_KNOWN_BUG(Message)
#define MAXSI_POSSIBLE_BUFFER_OVERRUN()
#define MAXSI_POSSIBLE_ALLOC_FAILURE()

#elif defined(Maxsi_Ignore_Bugs) // If we a doing a non-debug build with bugs left in.

#define MAXSI_TODO(Message)
#define MAXSI_TODO_LOW(Message)
#define MAXSI_UNDEFINED_BEHAVIOR(Message)
#define MAXSI_REMOVE_ME()
#define MAXSI_REMOVE_ME_LOW()
#define MAXSI_REMOVE_OLD_CODE()
#define MAXSI_KNOWN_BUG(Message)
#define MAXSI_POSSIBLE_BUFFER_OVERRUN()
#define MAXSI_POSSIBLE_ALLOC_FAILURE()

#elif defined(Maxsi_Disable_Bugs) // If we are doing a release build that is overly strict.

#define MAXSI_TODO(Message) YOU_FORGOT_TO_IMPLEMENT_SOMETHING
#define MAXSI_TODO_LOW(Message) YOU_FORGOT_TO_IMPLEMENT_SOMETHING
#define MAXSI_UNDEFINED_BEHAVIOR(Message)
#define MAXSI_REMOVE_ME() LOOKS_LIKE_YOU_FORGOT_TO_REMOVE_DEBUG_STUFF
#define MAXSI_REMOVE_ME_LOW() LOOKS_LIKE_YOU_FORGOT_TO_REMOVE_DEBUG_STUFF
#define MAXSI_REMOVE_OLD_CODE() LOOKS_LIKE_YOU_GOT_SOME_UNUSED_OLD_CODE
#define MAXSI_KNOWN_BUG(Message) THERE_IS_A_KNOWN_BUG_AROUND_HERE
#define MAXSI_POSSIBLE_BUFFER_OVERRUN() YOU_GOT_A_POSSIBLE_BUFFER_OVERRUN
#define MAXSI_POSSIBLE_ALLOC_FAILURE() YOU_GOT_A_POSSIBLE_MEMORY_ALLOCATION_FAILURE

#elif defined(Maxsi_Release_Build) // If we are ddoing a normal release build where low priority problems are left in.

#define MAXSI_TODO(Message) YOU_FORGOT_TO_IMPLEMENT_SOMETHING
#define MAXSI_TODO_LOW(Message)
#define MAXSI_UNDEFINED_BEHAVIOR(Message)
#define MAXSI_REMOVE_ME() LOOKS_LIKE_YOU_FORGOT_TO_REMOVE_DEBUG_STUFF
#define MAXSI_REMOVE_ME_LOW()
#define MAXSI_REMOVE_OLD_CODE() LOOKS_LIKE_YOU_GOT_SOME_UNUSED_OLD_CODE
#define MAXSI_KNOWN_BUG(Message)
#define MAXSI_POSSIBLE_BUFFER_OVERRUN() YOU_GOT_A_POSSIBLE_BUFFER_OVERRUN
#define MAXSI_POSSIBLE_ALLOC_FAILURE() YOU_GOT_A_POSSIBLE_MEMORY_ALLOCATION_FAILURE

#endif

#ifdef Maxsi_Support_W32
//=============================================================================
//	MaxsiError W32Error2MaxsiError(DWORD W32Error);
//
//	Converts a Windows error to a MaxsiError value.
//=============================================================================
LINK MaxsiError W32Error2MaxsiError(DWORD W32Error);
#endif

EndMaxsiNamespace

#endif
